//
//  HomeAPI.swift
//  LeGou
//
//  Created by lxm on 2022/7/27.
//
import Foundation

enum PowerAPI {
    // 充值选项
    case power_option
    // 创建订单
    case power_order_create(_ pa: [String: Any])
    // 订单列表
    case power_order_list(_ pa: [String: Any])
}

extension PowerAPI: ZMApiProvider {
    func BaseUrl() -> String {
        return baseUrl
    }
    
    func urlAndMthodAndParam() -> (url: String, method: ZMHTTPMethod, params: [String : Any], body: Bool) {
        switch self {
        case .power_option:
            return ("/api/front/electric/listDenomination", .get, [:], false)
        case .power_order_create(let pa):
            return ("/api/front/electric/create", .post, pa, true)
        case .power_order_list(let pa):
            return ("/api/front/electric/listOrder", .get, pa, false)
        }
    }
    
    func HTTPHeader() -> ZMHTTPHeaders? {
        return AppHelper.reqeustHeader()
    }
    
    func UpLoadData() -> [Data]? {
        return nil
    }
    
    func singleRequest() -> Bool {
        switch self {
            case .power_order_list:
                return true
            default:
                return false
        }
    }
}
